/**
 *  Copyright 2011 Marco Berri - marcoberri@gmail.com
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and limitations under the License.
 **/
package com.mbfasttrack.model;

import java.util.Date;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * @author Marco Berri marcoberri@gmail.com http://tecnicume.blogspot.com
 */
@Document
public class Comment  implements Base {

    @Id
    @Indexed
    private String id;
    private String description;
    private Date date = new Date(System.currentTimeMillis());
    @DBRef
    private User user;
    @DBRef
    private Base object;
    @DBRef
    private Comment parent;    
    @Transient
    private String objtype;
    @Transient
    private String objid;    
    @Transient
    private String parentid;
  
    /**
     * 
     * @return
     */
    public String toString() {
        return "[ id: " + this.id
                + " description:" + this.description
                + " user:" + this.user
                + " object:" + this.object
                + " objtype:" + this.objtype
                + " objid:" + this.objid
                 + " parent:" + this.parent               
                + " ]";
    }

    /**
     * 
     */
    public Comment() {
    }

    /**
     * @return the id
     */
    public String getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(String id) {
        this.id = id;
    }

 

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }

  


    /**
     * @return the user
     */
    public User getUser() {
        return user;
    }

    /**
     * @param user the user to set
     */
    public void setUser(User user) {
        this.user = user;
    }



    /**
     * @return the object
     */
    public Base getObject() {
        return object;
    }

    /**
     * @param object the object to set
     */
    public void setObject(Base object) {
        this.object = object;
    }

    /**
     * @return the objtype
     */
    public String getObjtype() {
        return objtype;
    }

    /**
     * @param objtype the objtype to set
     */
    public void setObjtype(String objtype) {
        this.objtype = objtype;
    }

    /**
     * @return the objid
     */
    public String getObjid() {
        return objid;
    }

    /**
     * @param objid the objid to set
     */
    public void setObjid(String objid) {
        this.objid = objid;
    }

    /**
     * @return the comment
     */
    public Comment getParent() {
        return parent;
    }

    /**
     * @param parent 
     */
    public void setParent(Comment parent) {
        this.parent = parent;
    }

    /**
     * @return the parentid
     */
    public String getParentid() {
        return parentid;
    }

    /**
     * @param parentid the parentid to set
     */
    public void setParentid(String parentid) {
        this.parentid = parentid;
    }

    /**
     * @return the date
     */
    public Date getDate() {
        return date;
    }

    /**
     * @param date 
     */
    public void setDate(Date date) {
        this.date = date;
    }

}
